/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.imageio.jpeg.metadata;

import java.util.Date;

/**
 * Additional image information.
 * <p>Thread safe.
 */
public class Info {

    private String filePath;
    private String createDate;
    private Date fileLastModifDate;

    //----------------------------------------------------------------------

    public Info(String filePath, String createDate, Date fileLastModifDate) {
        if(filePath == null) throw new NullPointerException("Parameter filePath is null");
        if("".equals(filePath)) throw new IllegalArgumentException("Parameter filePath has empty value");
        if(createDate == null) throw new NullPointerException("Parameter createDate is null");
        if(fileLastModifDate == null) throw new NullPointerException("Parameter fileLastModifDate is null");

        this.filePath = filePath;
        this.createDate = createDate;
        this.fileLastModifDate = (Date) fileLastModifDate.clone();
    }

    //----------------------------------------------------------------------

    public String getFilePath() {
        return filePath;
    }

    public String getCreateDate() {
        return createDate;
    }

    public Date getFileLastModifDate() {
        return (Date) fileLastModifDate.clone();
    }

    public void setFileLastModifDate(Date fileLastModifDate) {
        if(fileLastModifDate == null) throw new NullPointerException("Parameter fileLastModifDate is null");

        this.fileLastModifDate = (Date) fileLastModifDate.clone();
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Info");
        sb.append("{filePath='").append(filePath).append('\'');
        sb.append(", createDate='").append(createDate).append('\'');
        sb.append(", fileLastModifDate=").append(fileLastModifDate);
        sb.append('}');
        return sb.toString();
    }
}
